<template>
	<view class="u-page">
		<!-- <u-image width="100%" :src="require('../../static/img/rx.png')"></u-image> -->
		<!-- <view class="index-block">
			<u-calendar :minDate="minDate" :defaultDate="defaultDate" monthNum ='24' @close="showSpan=false" :show="showSpan" @confirm="confirmspan" mode="range"></u-calendar>
			<u-datetime-picker
			        :show="show"
			        v-model="value1"
			        mode="year-month"
					@confirm="confirm"
					@cancel="show=false"
			></u-datetime-picker>
			<view class="index-block-title" >工程统计
			<u-text v-if="!isMonth" :text="start+'到'+end" color="blue" size='14' @click="showSpan=true"  ></u-text>
			<u-text v-if="isMonth" :text="year+'年'+month+'月'" color="blue" size='14' @click="show=true"  suffixIcon='arrow-down-fill'></u-text>
			
			</view>
			<u-text :text="!isMonth?'按月份':'按时间段'" color="blue" size='14' @click="changeisMonth()"  suffixIcon='arrow-down-fill'></u-text>
			<u-row>
				<u-col span="4"  @click="goimage">
				 <u-text text="在建工程" color="blue" size='14' ></u-text>	<u-count-to fontSize='14' :startVal="0" :endVal="buildcount['在建工程']" color="blue" ></u-count-to>
				</u-col>
				<u-col span="4">
					<u-text text="总立项工程" color="brown" size='14'></u-text>	<u-count-to  fontSize='14':startVal="0" :endVal="buildcount['总立项工程']"  color="brown" ></u-count-to>
				</u-col>
				<u-col span="4">
					<u-text text="已派工未进场" color="darkorange" size='14'></u-text>	<u-count-to fontSize='14' :startVal="0" :endVal="buildcount['已派工未进场施工']" color="darkorange"></u-count-to>
				</u-col>
			</u-row>
			<u-row>
				<u-col span="4">
				 <u-text text="今日施工工程"  color="green" size='14'></u-text>	<u-count-to  fontSize='14' color="green" :startVal="0" :endVal="buildcount['今日施工工程']" ></u-count-to>
				</u-col>
				<u-col span="4">
					<u-text text="已巡检工程"  color="fuchsia" size='14'></u-text>	<u-count-to fontSize='14'  color="fuchsia" :startVal="0" :endVal="buildcount['已巡检工程']" ></u-count-to>
				</u-col>
				<u-col span="4">
					<u-text text="未巡检工程" color="goldenrod" size='14'></u-text>	<u-count-to fontSize='14' color="goldenrod" :startVal="0" :endVal="buildcount['未巡检工程']" ></u-count-to>
				</u-col>
			</u-row>
			<u-row>
				<u-col span="4">
				 <u-text text="整改工单" color="#3e4549e6" size='14'></u-text>	<u-count-to fontSize='14' color="#3e4549e6" :startVal="0" :endVal="buildcount['整改工单']" ></u-count-to>
				</u-col>
				<u-col span="4">
					<u-text text="未完成整改工单" color="goldenrod" size='14'></u-text>	<u-count-to fontSize='14' color="goldenrod" :startVal="0" :endVal="buildcount['未完成整改工单']" ></u-count-to>
				</u-col>
				<u-col span="4">
					<u-text text="整改时限完成率" color="#1b3e76" size='14'></u-text>	
					<u-text :text="`${buildcount['整改时限完成率']}%`" color="#1b3e76"></u-text></u-col> -->
					<!-- <u-count-to fontSize='18' color="#1b3e76" :startVal="0" :endVal="buildcount['整改时限完成率']" ></u-count-to> -->
				<!-- </u-col>
			</u-row>
			<u-row>
				<u-col span="4">
				  <u-text text="安全交底合格率" color="red"  size='14'></u-text> -->
					  <!-- <u-count-to fontSize='18'  color="red":startVal="0" :endVal="buildcount['安全交底合格率']" ></u-count-to> -->
				<!-- <u-text :text="`${buildcount['安全交底合格率']}%`"  size='14' color="red"></u-text></u-col>

				<u-col span="4" @click="openPage('sendwork/buildlist')">
					<u-text text="待派工" color="#f10606e6"  size='14'></u-text>	<u-count-to fontSize='14' color="#f10606e6" :startVal="0" :endVal="buildcount['待派工']" ></u-count-to>
				</u-col>
				

			</u-row> 
			<u-row v-if='user.UserRoleList[0].Role.Name=="管理员角色" || user.UserRoleList[0].Role.Name=="公司领导"'>
				<u-col span="4" >
					<u-text text="工程收款" color="green"  size='14'></u-text>	<u-count-to mode="price" separator="," fontSize='14' color="green" :startVal="0" :endVal="buildcount['工程收款']" ></u-count-to>
				</u-col>
				<u-col span="4">
				  <u-text text="工程劳务付款" color="red"  size='14'></u-text> -->
					  <!-- <u-count-to fontSize='18'  color="red":startVal="0" :endVal="buildcount['安全交底合格率']" ></u-count-to> -->
				<!-- <u-count-to :startVal="0" mode="price" :endVal="buildcount['工程付款']" separator=","  fontSize='14' color="red"></u-count-to></u-col>
			
	
			</u-row> -->
			<!-- <u-row gutter="16">
				<u-col span="4">
					<view class="item-tj item-tj-frist">
						<view style="padding: 16rpx; height: 100%; position: relative;font-size: 16px;">
							<view style="display: flex; color: white;flex-direction: row;" @click="sendwxmsg">
								<u-icon name="photo" color="#fff"></u-icon>
								<text>在建</text>
							</view>
							<view style="position: absolute; bottom: 48rpx; right: 16rpx;">
								<u-count-to :startVal="0" :endVal="buildcount.on" :duration="1500" color="#fff"
									separator=","></u-count-to>
							</view>
						</view>
		 		</view>
		 	</u-col>
				<u-col span="4">
					<view class="item-tj item-tj-second">
						<view style="padding: 16rpx; height: 100%; position: relative;font-size: 16px; ">
							<view style="display: flex; color: white;   flex-direction: row;">
								<u-icon name="photo" color="#fff"></u-icon>
								<text>竣工</text>
							</view>
							<view style="position: absolute; bottom: 48rpx; right: 16rpx;">
								<u-count-to :startVal="1" :endVal="buildcount.finish" :duration="1500" color="#fff"
									separator=","></u-count-to>
							</view>
						</view>
					</view>
		 	</u-col>
				<u-col span="4">
					<view class="item-tj item-tj-thrid">
						<view style="padding: 16rpx; height: 100%; position: relative;font-size: 16px;">
							<view style="display: flex; color: white;flex-direction: row;">
								<u-icon name="photo" color="#fff"></u-icon>
								<text>总数</text>
							</view>
							<view style="position: absolute; bottom: 48rpx; right: 16rpx;">
								<u-count-to :startVal="1" :endVal="buildcount.all" :duration="1500" color="#fff"
									separator=","></u-count-to>
							</view>
						</view>
					</view>
		 	</u-col>
			</u-row> -->
		<!-- </view> -->

		<view class="u-demo-block">
			<text class="u-demo-block__title">工程管理</text>

			<view>
				<u-grid :border="false" col="3">
					<!-- 					<u-grid-item
						v-for="(listItem,listIndex) in list"
						:key="listIndex"
						customStyle="padding-top: 10px; padding-bottom: 10px"
					>
						<u-icon
							:customStyle="{paddingTop:20+'rpx'}"
							:name="listItem.name"
							:size="22"
						></u-icon>
						<text class="grid-text">{{listItem.title}}</text>
					</u-grid-item> -->
					<!-- 	<u-grid-item customStyle="padding-top: 10px; padding-bottom: 10px">
						<u-icon :customStyle="{paddingTop:20+'rpx'}"
							name="https://cdn.uviewui.com/uview/example/cell.png" @click="openPage('buildlistForSafe')" :size="40" ></u-icon>
						<text class="grid-text">安全交底</text>
					</u-grid-item> -->
					<u-grid-item customStyle="padding-top: 10px; padding-bottom: 10px"
						@click="goimage">
						<u-icon :customStyle="{paddingTop:20+'rpx'}"
							name="https://project.gxrunxiang.com/cdn/calendar.png" 
							:size="40"></u-icon>
						<text class="grid-text">安全交底与日志</text>
					</u-grid-item>
					<u-grid-item customStyle="padding-top: 10px; padding-bottom: 10px"
						@click="openPage('buildlist2')">
						<u-icon :customStyle="{paddingTop:20+'rpx'}"
							name="https://project.gxrunxiang.com/cdn/color.png" 
							:size="40"></u-icon>
						<text class="grid-text">工程巡检</text>
					</u-grid-item>
					<u-grid-item customStyle="padding-top: 10px; padding-bottom: 10px"
						@click="openPage('todo?flowid=8')">
						<u-icon :customStyle="{paddingTop:20+'rpx'}"
							name="https://project.gxrunxiang.com/cdn/picker.png" :size="40"
							></u-icon>
						<u-badge max="99" :value="todocounts['8']||0" :offset="[20,35]" :absolute="true"></u-badge>
						<text class="grid-text">工程审批</text>
					</u-grid-item>
					<u-grid-item customStyle="padding-top: 10px; padding-bottom: 10px"
						@click="openPage('buildlistForFinish')">
						<!-- <u-badge max="99" :value="todocounts['10']||0" :offset="[20,35]" :absolute="true"></u-badge> -->
						<u-icon :customStyle="{paddingTop:20+'rpx'}"
							name="https://project.gxrunxiang.com/cdn/checkbox.png" :size="40"></u-icon>
						<u-badge max="99" :value="todocounts['10']||0" :offset="[20,35]" :absolute="true"></u-badge>
						<text class="grid-text">工程验收</text>
					</u-grid-item>
					<u-grid-item customStyle="padding-top: 10px; padding-bottom: 10px"
						@click="openPage('todo?flowid=7')">
						<u-icon :customStyle="{paddingTop:20+'rpx'}"
							name="https://project.gxrunxiang.com/cdn/parse.png" :size="40"></u-icon>
						<u-badge max="99" :value="todocounts['7']||0" :offset="[20,35]" :absolute="true"></u-badge>
						<text class="grid-text">工程变更</text>
					</u-grid-item>
					<u-grid-item customStyle="padding-top: 10px; padding-bottom: 10px"
						@click="openPage('buildputright/list')">
						<u-icon :customStyle="{paddingTop:20+'rpx'}"
							name="https://project.gxrunxiang.com/cdn/transition.png" :size="40"></u-icon>
						<u-badge max="99" :value="todocounts['5']||0" :offset="[20,35]" :absolute="true"></u-badge>
						<text class="grid-text">工程整改</text>
					</u-grid-item>
					<u-grid-item customStyle="padding-top: 10px; padding-bottom: 10px"
						@click="openPage('buildlist')">
						<u-icon :customStyle="{paddingTop:20+'rpx'}"
							name="https://project.gxrunxiang.com/cdn/list1.png" :size="40"></u-icon>
						<text class="grid-text">新建工程</text>
					</u-grid-item>
					<!-- <u-grid-item customStyle="padding-top: 10px; padding-bottom: 10px"
						@click="openPage('sendwork/buildlist')">
						<u-icon :customStyle="{paddingTop:20+'rpx'}"
							name="https://project.gxrunxiang.com/cdn/top.png" :size="40"></u-icon>
						<u-badge max="99" :value="buildcount['待派工']" :offset="[20,35]" :absolute="true"></u-badge>
						<text class="grid-text">工程派工</text>
					</u-grid-item> -->
					<u-grid-item customStyle="padding-top: 10px; padding-bottom: 10px"
						@click="openPage('buildworker')">
						<u-icon :customStyle="{paddingTop:20+'rpx'}"
							name="https://project.gxrunxiang.com/cdn/builder.png" :size="40"></u-icon>
						<text class="grid-text">施工人员</text>
					</u-grid-item>
					<u-grid-item customStyle="padding-top: 10px; padding-bottom: 10px"
						@click="openPage('buildstatistic')" v-if="user.Roles.indexOf('施工负责人角色') == -1 && user.Roles.indexOf('合作单位负责人') == -1 
						&& user.Roles.indexOf('普通用户') == -1 && user.Roles.indexOf('腾讯测试') == -1 && user.Roles.indexOf('故障填报角色') == -1">
						<u-icon :customStyle="{paddingTop:20+'rpx'}"
							name="https://project.gxrunxiang.com/cdn/desc.png" :size="40"></u-icon>
						<text class="grid-text">工程统计</text>
					</u-grid-item>
				</u-grid>
			</view>

		</view>
		
		
		
		<view class="u-demo-block">
			<text class="u-demo-block__title">运维管理</text>
			<view>
				<u-grid :border="false" col="3">
					<u-grid-item customStyle="padding-top: 10px; padding-bottom: 10px"
						@click="openPage('Protect/fault')">
						<u-icon :customStyle="{paddingTop:20+'rpx'}"
							name="https://project.gxrunxiang.com/cdn/fault.png" :size="40"></u-icon>
							<u-badge max="99" :value="buildcount['待处理故障']" :offset="[20,35]" :absolute="true"></u-badge>
						<text class="grid-text">维护工单</text>					
					</u-grid-item>
					<!-- <u-grid-item customStyle="padding-top: 10px; padding-bottom: 10px"
						@click="openPage('Protect/cmwarn')">
						<u-icon :customStyle="{paddingTop:20+'rpx'}"
							name="https://project.gxrunxiang.com/cdn/navbar.png" :size="40"></u-icon>
						<text class="grid-text">cm告警</text>							
					</u-grid-item>
					<u-grid-item customStyle="padding-top: 10px; padding-bottom: 10px"
						@click="openPage('Protect/upchannelwarn')">
						<u-icon :customStyle="{paddingTop:20+'rpx'}"
							name="https://project.gxrunxiang.com/cdn/alert.png" :size="40"></u-icon>
						<text class="grid-text">上行通道告警</text>
					</u-grid-item> -->
					<u-grid-item customStyle="padding-top: 10px; padding-bottom: 10px">
						<u-icon :customStyle="{paddingTop:20+'rpx'}"
							name="https://project.gxrunxiang.com/cdn/line.png" @click="openPage(mapurl)"
							:size="40"></u-icon>
						<text class="grid-text">干线线路采集</text>
					</u-grid-item>
					<u-grid-item customStyle="padding-top: 10px; padding-bottom: 10px"
						@click="openPage('Protect/protopticalpower')">
						<u-icon :customStyle="{paddingTop:20+'rpx'}"
							name="https://project.gxrunxiang.com/cdn/ggl.png" :size="40"></u-icon>
						<text class="grid-text">onu光功率低</text>
					</u-grid-item>
				</u-grid>
				<u-grid :border="false" col="3">	
					<!-- #ifdef MP-WEIXIN || MP-QQ || MP-BAIDU -->
					<u-grid-item customStyle="padding-top: 10px; padding-bottom: 10px"
						@click="openPage('Protect/linepathnode')">
						<u-icon :customStyle="{paddingTop:20+'rpx'}"
							name="https://project.gxrunxiang.com/cdn/lineequ.png" :size="40"></u-icon>
						<text class="grid-text">资源采集(含设备)</text>
					</u-grid-item>
					<!-- #endif-->
					<!-- #ifdef APP-PLUS -->
					<u-grid-item customStyle="padding-top: 10px; padding-bottom: 10px"
						@click="openPage('checkline')">
						<u-icon :customStyle="{paddingTop:20+'rpx'}"
							name="https://project.gxrunxiang.com/cdn/checkline.png" :size="40"></u-icon>
						<text class="grid-text">巡线</text>
					</u-grid-item>
					<!-- #endif-->
					<u-grid-item customStyle="padding-top: 10px; padding-bottom: 10px"
						@click="openPage('Protect/protorder')">
						<u-icon :customStyle="{paddingTop:20+'rpx'}"
							name="https://project.gxrunxiang.com/cdn/proj2.png" :size="40"></u-icon>
						<text class="grid-text">系统外工单维护记录</text>
					</u-grid-item>
					<u-grid-item customStyle="padding-top: 10px; padding-bottom: 10px"
						@click="openPage('todo?flowid=store')">
						<u-icon :customStyle="{paddingTop:20+'rpx'}"
							name="https://project.gxrunxiang.com/cdn/storetodo.png" :size="40"></u-icon>
						<text class="grid-text">出入库审批</text>
					</u-grid-item>
				</u-grid>
			</view>
			<!-- <button open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">{{code}}xxx</button> -->
		</view>
		<view class="u-demo-block">
			<text class="u-demo-block__title">项目管理</text>
			<view>
				<u-grid :border="false" col="3">

					<u-grid-item customStyle="padding-top: 10px; padding-bottom: 10px"
						@click="openPage('todo?flowid=2')">
						<u-icon :customStyle="{paddingTop:20+'rpx'}"
							name="https://project.gxrunxiang.com/cdn/form.png" :size="40"></u-icon>
						<u-badge max="99" :value="todocounts['2']||0" :offset="[15,28]" :absolute="true"></u-badge>
						<text class="grid-text">总部立项</text>

					</u-grid-item>
					<u-grid-item customStyle="padding-top: 10px; padding-bottom: 10px"
						@click="openPage('todo?flowid=1237a83b-b813-437c-a5ef-b9302aaf2768')">
						<u-icon :customStyle="{paddingTop:20+'rpx'}"
							name="https://project.gxrunxiang.com/cdn/proj2.png" :size="40"></u-icon>
						<u-badge max="99" :value="todocounts['1237a83b-b813-437c-a5ef-b9302aaf2768']||0" :offset="[15,28]" :absolute="true"></u-badge>
						<text class="grid-text">分公司立项</text>
					
					</u-grid-item>
					<u-grid-item customStyle="padding-top: 10px; padding-bottom: 10px"
						@click="openPage('todo?flowid=4')">
						<u-icon :customStyle="{paddingTop:20+'rpx'}"
							name="https://project.gxrunxiang.com/cdn/alert.png" :size="40"></u-icon>
						<u-badge max="99" :value="todocounts['4']||0" :offset="[20,35]" :absolute="true"></u-badge>
						<text class="grid-text">项目延期</text>
					</u-grid-item>
					<u-grid-item customStyle="padding-top: 10px; padding-bottom: 10px"
						@click="openPage('todo?flowid=11')">
						<u-icon :customStyle="{paddingTop:20+'rpx'}"
							name="https://project.gxrunxiang.com/cdn/checkbox.png" :size="40"></u-icon>
						<u-badge max="99" :value="todocounts['11']||0" :offset="[2035]" :absolute="true"></u-badge>
						<text class="grid-text">总部项目竣工</text>
					</u-grid-item>
					<u-grid-item customStyle="padding-top: 10px; padding-bottom: 10px"
						@click="openPage('todo?flowid=a3bf67c0-8957-4e28-983a-b2608cfe2869')">
						<u-icon :customStyle="{paddingTop:20+'rpx'}"
							name="https://project.gxrunxiang.com/cdn/checkBox2.png" :size="40"></u-icon>
						<u-badge max="99" :value="todocounts['a3bf67c0-8957-4e28-983a-b2608cfe2869']||0" :offset="[2035]" :absolute="true"></u-badge>
						<text class="grid-text">分公司项目竣工</text>
					</u-grid-item>
					<u-grid-item customStyle="padding-top: 10px; padding-bottom: 10px"
						@click="openPage('todo?flowid=3')">
						<u-icon :customStyle="{paddingTop:20+'rpx'}"
							name="https://project.gxrunxiang.com/cdn/parse.png" :size="40"></u-icon>
						<u-badge max="99" :value="todocounts['3']||0" :offset="[20,35]" :absolute="true"></u-badge>
						<text class="grid-text">项目变更</text>
					</u-grid-item>
					
				</u-grid>
				<u-grid>
					<u-grid-item customStyle="padding-top: 10px; padding-bottom: 10px"
						@click="openPage('Store/scancode')">
						<u-icon :customStyle="{paddingTop:20+'rpx'}"
							name="https://project.gxrunxiang.com/cdn/scancode.png" :size="40"></u-icon>
						<text class="grid-text">货物扫描</text>
					</u-grid-item>
				</u-grid>
			</view>
			<!-- <button open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">{{code}}xxx</button> -->
		</view>

		<view class="u-demo-block">
			<text class="u-demo-block__title">车辆管理</text>
			<view>
				<u-grid :border="false" col="3">
					<u-grid-item customStyle="padding-top: 10px; padding-bottom: 10px"
						@click="openPage('Car/car')">
						<u-icon :customStyle="{paddingTop:20+'rpx'}"
							name="https://project.gxrunxiang.com/cdn/car.png" :size="40"></u-icon>
						<text class="grid-text">车辆信息</text>
					</u-grid-item>
					<u-grid-item customStyle="padding-top: 10px; padding-bottom: 10px"
						@click="openPage('Car/carapply')">
						<u-icon :customStyle="{paddingTop:20+'rpx'}"
							name="https://project.gxrunxiang.com/cdn/carApply.png" 
							:size="40"></u-icon>
						<u-badge max="99" :value="buildcount['用车申请']||0" :offset="[15,28]" :absolute="true"></u-badge>
						<text class="grid-text">用车审批</text>
					</u-grid-item>
					<u-grid-item customStyle="padding-top: 10px; padding-bottom: 10px"
						@click="openPage('Car/carreturn')">
						<u-icon :customStyle="{paddingTop:20+'rpx'}"
							name="https://project.gxrunxiang.com/cdn/carReturn.png" :size="40"></u-icon>
						<u-badge max="99" :value="buildcount['用车归还']||0" :offset="[15,28]" :absolute="true"></u-badge>
						<text class="grid-text">用车归还</text>
					</u-grid-item>
				</u-grid>
				<u-grid :border="false" col="3">	
					<u-grid-item customStyle="padding-top: 10px; padding-bottom: 10px"
						@click="openPage('todo?flowid=775c5e6e-c7e4-441a-81c2-a242252393d8')">
						<u-icon :customStyle="{paddingTop:20+'rpx'}"
							name="https://project.gxrunxiang.com/cdn/maintenance.png" :size="40"></u-icon>
							<u-badge max="99" :value="todocounts['775c5e6e-c7e4-441a-81c2-a242252393d8']||0" :offset="[15,28]" :absolute="true"></u-badge>
						<text class="grid-text">保养维修审批</text>
					</u-grid-item>
				</u-grid>	
			</view>
			<!-- <button open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">{{code}}xxx</button> -->
		</view>
		
		<!-- <button open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">{{code}}xxx</button> -->
		<!-- 	<view class="u-demo-block">
			<text class="u-demo-block__title">可滑动</text>
			<view>
				<swiper
					:indicator-dots="true"
					class="swiper"
				>
					<swiper-item>
						<u-grid :border="true">
							<u-grid-item
								v-for="(item, index) in swiperList"
								:index="index"
								:key="index"
							>
								<u-icon
									:customStyle="{paddingTop:20+'rpx'}"
									:name="item"
									:size="22"
								></u-icon>
								<text class="grid-text">{{ '宫格' + (index + 1) }}</text>
							</u-grid-item>
						</u-grid>
					</swiper-item>
					<swiper-item>
						<u-grid :border="true">
							<u-grid-item
								v-for="(item, index) in swiperList"
								:index="index + 9"
								:key="index"
							>
								<u-icon
									:customStyle="{paddingTop:20+'rpx'}"
									:name="item"
									:size="22"
								></u-icon>
								<text class="grid-text">{{ '宫格' + (index + 1) }}</text>
							</u-grid-item>
						</u-grid>
					</swiper-item>
					<swiper-item>
						<u-grid :border="true">
							<u-grid-item
								v-for="(item, index) in swiperList"
								:index="index + 18"
								:key="index"
							>
								<u-icon
									:customStyle="{paddingTop:20+'rpx'}"
									:name="item"
									:size="22"
								></u-icon>
								<text class="grid-text">{{ "宫格" + (index + 1) }}</text>
							</u-grid-item>
						</u-grid>
					</swiper-item>
				</swiper>
			</view>
		</view> -->

		<u-notify ref="uNotify" message="Hi uView"></u-notify>
		<!-- #ifdef MP-WEIXIN -->
			<!-- <privacyPopup ></privacyPopup> -->
		<!-- #endif -->

	</view>
</template>

<script>
		const d = new Date()
		const year = d.getFullYear()
		let month = d.getMonth() + 1
		month = month < 10 ? `0${month}` : month
		const date = d.getDate()
	import {
		getuser,
		getMenu,
		getbuildcount,
		todocount,
		sendwxmsg
	} from '@/common/api.js';
	import {
		mapGetters,
		mapMutations
	} from 'vuex'
	// import privacyPopup from '@/components/easy-components.vue'
	export default {
		data() {
			return {
				minDate:`${(new Date().getFullYear())-1}-1-1`,
				defaultDate:[`${year}-${month}-${date}`],
				// maxDate:new Date().getFullYear()+"-"+new Date().getMonth()+1+"-"+new Date().getDay()+1,
				start:'',
				end:'',
				showSpan:false,
				isMonth:true,
				year:new Date().getFullYear(),
				month:new Date().getMonth()+1,
				todocounts: {},
				code: "",
				// pathmy: "pages/example/components",
				buildcount: {},
				env:"app",
				mapurl:"",
				show:false,
				value1: Number(new Date()),
				user: JSON.parse(uni.getStorageSync("$userinfo")),
				version: "",
			}
		},
		
		// components:{
		// 	privacyPopup
		// },
		created() {
			this.env = uni.getSystemInfoSync().uniPlatform
			if (this.env == "mp-weixin") {
					this.mapurl="vxmap"
			
				} else {
					this.mapurl="arcmap"
				}
			console.log(this.mapurl);
		},
		
		onLoad() {
			
			console.log(this.env) // app
		
		},
	
		onShow() {
			// this.todocounts = {}
			this.getbuildcount()
			var allcount = 0
			todocount().then(res => {
				this.todocounts={}
				res.forEach(e => {
					this.todocounts[e.FlowId] = e.count
					allcount += e.count
				})
				if (allcount != 0)
					uni.setTabBarBadge({
						index: 0, // 索引
						text: allcount + '' // 注意：text 的值必须是字符串，不能是数字
					})
			})

		},
		methods: {
			confirmspan(e)
			{
				this.start=e[0]
				this.end=e[e.length-1]
				this.showSpan=false
				this.getbuildcount()
			},
			changeisMonth()
			{
				this.isMonth=!this.isMonth
				if(!this.isMonth)
				{
					this.showSpan=true
					// this.year=0
					// this.month=0
				}
				else
				{
					this.year=new Date().getFullYear()
					this.month=new Date().getMonth()+1
					this.start=this.end=''
				}
				this.getbuildcount()
				
			},
			sendwxmsg()
			{
				sendwxmsg()
			},
			getbuildcount() {
				getbuildcount(this.start,this.end,this.year,this.month).then(res => {
					this.buildcount = res
					console.log(this.buildcount['在建工程']+","+this.buildcount.在建工程)
				})
			},
			submsg()
			{
				if(!wx.requestSubscribeMessage)
				return
				wx.requestSubscribeMessage({
				  tmplIds: ['g4ZLePoinaX5DPKwRPgBCx15-KfF9F6CuqglDaZp06o','87hkQwY_d1P2s9t-2sOcP5kru3uNQuw53bdJosg043o'],
				  success (res) { 
					  // console.log(res)
					  // uni.navigateTo({
					  // 	url: url
					  // })
				  },
				  fail (res) {
				  					  console.log(res)
				  },
				})
			},
			getsubmsg()
			{
				if(!wx.getSetting)
				return
				wx.getSetting({
				  withSubscriptions: true,
				  success (res) {
				    console.log(res.authSetting)
				    // res.authSetting = {
				    //   "scope.userInfo": true,
				    //   "scope.userLocation": true
				    // }
				    console.log(res.subscriptionsSetting)
				    // res.subscriptionsSetting = {
				    //   mainSwitch: true, // 订阅消息总开关
				    //   itemSettings: {   // 每一项开关
				    //     SYS_MSG_TYPE_INTERACTIVE: 'accept', // 小游戏系统订阅消息
				    //     SYS_MSG_TYPE_RANK: 'accept'
				    //     zun-LzcQyW-edafCVvzPkK4de2Rllr1fFpw2A_x0oXE: 'reject', // 普通一次性订阅消息
				    //     ke_OZC_66gZxALLcsuI7ilCJSP2OJ2vWo2ooUPpkWrw: 'ban',
				    //   }
				    // }
				  }
				})
			},

			openPage(url) {
				this.getsubmsg()
				this.submsg(url)
				uni.navigateTo({
					url: url
				})
				// uni.$u.route({type: 'redirect', 
				// 	url: e
				// })
			},
			goimage()
			{
				this.submsg()
				uni.switchTab({
					url:"/pages/index/buildimages"
				})
			},
			confirm(e)
			{
				const timeFormat = uni.$u.timeFormat
				var t = timeFormat(e.value, 'yyyy-mm')
				this.year =t.split('-')[0]
				this.month =t.split('-')[1]
				this.getbuildcount()
				this.show=false
			},
		}
	}
</script>
<style lang="scss">
	.swiper {
		height: 220px;
	}

	.grid-text {
		font-size: 14px;
		color: #909399;
		padding: 10rpx 0 20rpx 0rpx;
		/* #ifndef APP-PLUS */
		box-sizing: border-box;
		/* #endif */
	}

	.index-content {
		background-color: #f3f4f6;
		min-height: 100vh;
	}

	.index-block {
		padding: 40rpx;
		background-color: #fff;
	}

	.index-block-title {
		font-size: 40rpx;
		font-weight: bold;
		padding: 0 0 40rpx 0;
	}

	.item-tj {

		width: 100%;
		height: 160rpx;
		border-radius: 16rpx;

		&-frist {
			background-color: rgba($color: #2979ff, $alpha: 0.8);
			// background-image: url('/static/img/bg/qb.png');
		}

		&-second {
			background-color: rgba($color: #303133, $alpha: 0.8);
			// background-image: url('/static/img/bg/qb.png');
		}

		&-thrid {
			background-color: rgba($color: #19be6b, $alpha: 0.8);
			// background-image: url('/static/img/bg/qb.png');
		}
	}

	.detail_list {
		height: 700rpx;
		overflow: auto;
		color: #9E9E9E;

		.detail_item {
			display: flex;
			flex-direction: row;
			margin: 20rpx 0;
			align-items: center;

			.icon {
				width: 30%;
				text-align: center;

				li {
					font-size: 80rpx;
				}
			}

			.right_content {
				width: 50%;
				text-align: center;
			}

			.icon-income {
				color: #4AABF9;
			}

			.icon-expend {
				color: #E45521;
			}

			.money {
				color: #000;
			}
		}
	}
</style>
